Ext.namespace("Task.ReFeedBack");

Task.ReFeedBack.win = function() {
	this.exeId;
	this.fb_status;
	this.to;//反馈接受人
	this.taskPercent = new Ext.form.NumberField({
		fieldLabel:'完成百分比',
		allowBlank:false,
		maxValue:100,
		minValue:0
		
	})
	
	this.feedBackContent = new Ext.form.TextArea({
		fieldLabel:'反馈内容',
		width:300,
		allowBlank:false,
		height:80,
		maxLength:200
	});
	this.form = new Ext.FormPanel({
        labelWidth: 75,
        frame:true,
        labelAlign: 'right',
        width: 420,
        items: [
         this.taskPercent,this.feedBackContent
		]
    });
    //反馈url
	this.addCon = new Ext.data.Connection({
		url:'../task/feedBackTask.form?timesnap=' + Date.parse(new Date()),
		method:'post'
	})
	this.btnBack = new Ext.Button({
		 text:'保存',
      //   cls: 'x-btn-text-icon btn-save',
         scope: this,
         handler:this.feedBack
	});
	this.tabPanel  = new Ext.TabPanel({
		height:450
	});
	
	Task.ReFeedBack.win.superclass.constructor.call(this, {
		title: '任务反馈',
        bodyStyle: 'padding: 5px 5px 0',
        autoHeight: true,
        width: 450,
        resizable: true,
        autoScroll: true,
        closeAction: 'hide',
        items: [this.form],
        buttons: [this.btnBack,new Ext.Button({text:'关闭',scope:this,handler:function(){this.hide()}})],
        buttonAlign:'center'
	});
};
Ext.extend(Task.ReFeedBack.win, Ext.Window, {
	initDetail:function(percent,exeId,fb_status,to){
		this.taskPercent.setValue(percent);
		this.exeId=exeId;
		this.fb_status= fb_status;
		this.to =to;
		this.feedBackContent.setValue('');
	},
	feedBack: function(btn, event) {
		if(!this.form.getForm().isValid()){
			return;
		}
		if (!this.loadMask) {
			 this.loadMask = new Ext.LoadMask(this.form.getEl(), {msg: '派发中，请稍候...'});
		}
		Utils.request(this.addCon,{
			params:{//反馈参数
				content : this.feedBackContent.getValue(),
				percent : this.taskPercent.getValue(),
				back_status:0,
				to:this.to,
				exeId:this.exeId
			},
			scope:this,
			success:function(){
				Utils.info("操作成功！");
				this.scope.hide();
				Task.Feed.list.instance.store.reload();
			}
		})
	}
});

